<template>
  <div class="cart">
    <h2>我的购物车</h2>
    <p>
      <i>请添加一些商品到购物车</i>
    </p>
    <ul>
      <li v-for="item in cartProducts">{{item.title}} - {{item.price}} × {{item.quantify}} </li>

    </ul>
    <p>商品总价：{{totalPrice}}</p>
    <p>
      <button @click="cartStore.chekout">结算</button>
    </p>
    <p v-show="checkoutStatus">结算{{checkoutStatus}}.</p>
  </div>
</template>

<script lang="ts" setup>
import { storeToRefs } from "pinia";
import { useCartStore } from "../store/cart";

const cartStore = useCartStore()
const {totalPrice,cartProducts,checkoutStatus }=storeToRefs(cartStore)


</script>